using System;
using Be.Timvw.Framework.Namespace1;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Be.Timvw.Framework
{
    [TestClass]
    public class WhenGettingCSharpTypeName
    {
        [TestMethod]
        public void ShouldReturnCSharpNameForCSharpType()
        {
            Type intType = typeof(int);
            string expected = "int";
            string actual = TypeHelper.GetCsharpTypeName(intType);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void ShouldReturnClassNameForNonCSharpType()
        {
            Type ns1Dummy1 = typeof(Dummy1);
            string expected = "Be.Timvw.Framework.Namespace1.Dummy1";
            string actual = TypeHelper.GetCsharpTypeName(ns1Dummy1);
            Assert.AreEqual(expected, actual);
        }

        public void DummyWithReferenceParameter(out string parameter)
        {
            parameter = string.Empty;
        }

        [TestMethod]
        public void ShouldReturnCSharpNameForCsharpReferenceType()
        {
            Type outStringType = this.GetType().GetMethod("DummyWithReferenceParameter").GetParameters()[0].ParameterType;
            string expected = "string";
            string actual = TypeHelper.GetCsharpTypeName(outStringType);
            Assert.AreEqual(expected, actual);
        }
    }
}